package org.feiye.studyday25.review;

import java.io.*;

public class ReadTest {

	public static void main(String[] args) {
		// 字符流读文件内容
		InputStream f = null;
		Reader i = null;
		try {
			// r = new FileReader("F:\\叶飞io测试\\test1fire.txt");
			f = new FileInputStream("F:\\叶飞io测试\\test1fire.txt");
			i = new InputStreamReader(f, "utf-8");
			char[] c = new char[1024];
			int re = 0;
			while ((re = i.read(c)) > -1) {
				// String s = new String(c, 0, re);
				// System.out.println(s);
				for (int j = 0; j < re; j++) {
					System.out.print(c[j]);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (i != null)
				try {
					i.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			if (f != null) {
				try {
					f.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

	}

}
